<h2>Why is this an issue?</h2>
<p>The use of literals (primitive values such as strings, numbers, booleans, etc.) for promise rejection is generally discouraged. While it is
syntactically valid to provide literals as a rejected promise value, it is considered best practice to use instances of the Error class or its
subclasses instead.</p>
<p>Using an instance of the Error class allows you to provide more meaningful information about the error. The Error class and its subclasses provide
properties such as message and stack that can be used to convey useful details about the error, such as a description of the problem, the context in
which it occurred, or a stack trace for debugging.</p>
<pre data-diff-id="1" data-diff-type="noncompliant">
new Promise(function(resolve, reject) {
  reject(); // Noncompliant: use Error object to provide rejection reason
});

new Promise(function(resolve, reject) {
  reject('Something went wrong'); // Noncompliant: use Error object instead of literal
});
</pre>
<p>To fix your code provide an instance of the Error class to the promise reject function.</p>
<pre data-diff-id="1" data-diff-type="compliant">
new Promise(function(resolve, reject) {
  reject(new Error('Network timeout'));
});

new Promise(function(resolve, reject) {
  reject(new Error('Something went wrong'));
});
</pre>
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://typescript-eslint.io/">typescript-eslint</a> - Rule <a
  href="https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-promise-reject-errors.mdx">prefer-promise-reject-errors</a> </li>
  <li> MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a> </li>
  <li> MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a> </li>
</ul>
<h3>Related rules</h3>
<ul>
  <li> {rule:javascript:S3696} - Literals should not be thrown </li>
</ul>
